//
//  ActivityElement.m
//  Tank For IPhone
//
//  Created by 奕 朱 on 11-3-2.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "ActivityElement.h"
#import "Constant.h"


@implementation ActivityElement
@synthesize direction;
@synthesize moveListener;

- (BOOL) move: (Integer *) _direction {
	NSLog(@"tank is moveing %d", [moveListener isCollide:self]);
	
	self.direction = _direction;
	
	BOOL isMove = [moveListener isCollide:self];
	
	if (isMove) {
		
		switch (self.direction.value) {
			case up:
				self.y = self.y - 10;
				break;
			case down:
				self.y = self.y + 10;
				break;
			case left:
				self.x = self.x - 10;
				break; 
			case right:
				self.x = self.x + 10;
				break;
		}
		
	}
	
	return isMove;
	
}

- (void) dealloc {
	[direction release];
	[super dealloc];
}

@end
